<?php
// +----------------------------------------------------------------------
// | Yzncms [ 御宅男工作室 ]
// +----------------------------------------------------------------------
// | Copyright (c) 2018 http://yzncms.com All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: 御宅男 <530765310@qq.com>
// +----------------------------------------------------------------------

// +----------------------------------------------------------------------
// | 安装脚本
// +----------------------------------------------------------------------
namespace app\templates\install;

use think\Db;
use util\Sql;
use \sys\InstallBase;

class install extends InstallBase
{
    /**
     * 安装完回调
     * @return boolean
     */
    public function end()
    {
        $cms_id = Db::name("menu")->where('title', '内容管理')->value('id');
        $parent_id = Db::name("menu")->insertGetId(['title'=>'模板管理','icon'=>'icon-file-fill','parentid'=>$cms_id,'app'=>'templates','controller'=>'template','action'=>'index','status'=>1]);
        $data = [
            ['title'=>'列表','parentid'=>$parent_id,'app'=>'templates','controller'=>'template','action'=>'index'],
            ['title'=>'编辑','parentid'=>$parent_id,'app'=>'templates','controller'=>'template','action'=>'edit']
        ];
        Db::name("menu")->insertAll($data);
        return true;
    }

}
